#include<stdio.h>
#define P1 0.4983
#define P2 0.5483
#define P3 0.7983
int main()
{
    int n,i,ws;
    double sum;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&ws);
        if (ws<=230)
        {
            sum = P1 * ws;
            printf("%.2lf\n",sum);
        }
        else if(ws<420&&ws>=231)
        {
            sum=230*P1+(ws-230)*P2;
            printf("%.2lf\n",sum);
        }
        else 
        {
            sum=230*P1+190*P2+(ws-420)*P3;
            printf("%.2lf\n",sum);
        }
    }
}
